import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-03-30
 * Time: 12:20
 */
class MyThread1 extends Thread{
    @Override
    public void run() {
        while (true) {
            try {
                sleep(1000);
                System.out.println("继承 Thread, 重写 run");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class test {
    public static void main(String[] args) throws InterruptedException {
        MyThread1 myThread =new MyThread1();
        myThread.start();
        while (true){
            sleep(1000);
            System.out.println("main主线程");

        }

    }
}
